package org.example.spring_blog.config;

import lombok.extern.slf4j.Slf4j;
import org.example.spring_blog.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ControllerAdvice
@ResponseBody
public class ExceptionHandle {

    @ExceptionHandler
    public Result handle(Exception e){
        log.error("打印异常信息：",e);

        return Result.fail("内部错误，请联系管理员");
    }



}
